import typescript from "rollup-plugin-typescript2";
import {
    nodeResolve
} from "@rollup/plugin-node-resolve";

import path from "path";

import vue from "rollup-plugin-vue";

import {
    getPackagesSync
} from "@lerna/project";

// getPackagesSync获取packages下面所有包的名字 过去所有packages 的所有的package.json 拿到名字
const inputs = getPackagesSync().map(pkg => pkg.name).filter(name => name.includes('@d-ui'));
// 只需要打包个button icon
export default {
    input: path.resolve(__dirname, '../packages/d-ui/index.ts'),
    output: {
        format: 'es',
        file: 'lib/index.esm.js'
    },
    plugin: [
        nodeResolve(),
        vue({
            target: 'brower',
        }),
        typescript({ //默认调用tsconfig.js
            tsconfigOverride:{
                exclude: [
                    'node_modules',
                    'website'
                ]
            }
        })
    ],
    external(id){ // 排除vue
        return /^vue/.test(id)
    }
}